Manager: Memory Manager
Carbon will support the majority of the Memory Manager programming interface. Changes will primarily affect applications that use zones, system memory, or temporary memory. For example, temporary memory allocations in Mac OS X will be allocated in the application's address space. As a result, calling TempNewHandle will effectively be the same as calling NewHandle.
Carbon will not support current functions for accessing the system heap, but Apple will provide new routines to allocate shared and persistent memory. In addition, the virtual memory system in Mac OS X will introduce a number of changes in the addressing model.
By adhering to the following guidelines, you can increase your application's compliance with Mac OS X memory management:
* Try to use memory only within your own application heap. Review the places where you allocate memory in the system heap.
* Do not pass pointers to data among applications through Apple events, Gestalt routines, or other means. For example, don't share Toolbox data structures between applications, because in Mac OS X, each application will run in its own protected address space.
* Do not use inline, hard-coded addresses.
* Do not modify the zone header to increase the number of master pointer blocks allocated by each call to the MoreMasters function. You should instead call MoreMasters multiple times. Each call to More Masters allocates 128 master pointers. Apple may supply a new version of the MoreMasters function that allows you to specify the number of master pointer blocks to allocate. Note, however, that master pointer blocks do not need to be preallocated or optimized in the Mac OS X environment, so the new function will only benefit Carbon applications running on Mac OS 8.
* Don't make assumptions about the layout of memory, such as the relative position of data stored in heaps, stacks, and other memory areas.
* Don't use the DisposePtr or DisposeHandle functions on pointers or handles allocated by Toolbox managers. For example, don't call the function DisposeHandle on a control allocated by the NewControl function; use DisposeControl instead.
* Because Mac OS X applications will run in a large, protected memory space, memory sizing routines such as MaxMem and FreeMem will work differently than they do now.
ApplicationZone
BlockMove
BlockMoveData
BlockMoveDataUncached
BlockMoveUncached
BlockZero
BlockZeroUncached
CallGrowZoneProc
CallPurgeProc
CallUserFnProc
CheckAllHeaps
CompactMem
CompactMemSys
Operations on the system heap are not allowed.
DebuggerEnter
DebuggerExit
DebuggerGetMax
DebuggerLockMemory
DebuggerPoll
DebuggerUnlockMemory
DeferUserFn
DisposeGrowZoneUPP
DisposeHandle
DisposePtr
DisposePurgeUPP
DisposeUserFnUPP
EmptyHandle
EnterSupervisorMode
FlushMemory
FreeMem
FreeMemSys
Operations on the system heap are not allowed in Carbon.
GetApplLimit
GetHandleSize
GetPageState
GetPhysical
GetPtrSize
GetZone
GrowZoneProcPtr
GZSaveHnd
HandAndHand
HandleZone
HandToHand
HClrRBit
HGetState
HLock
HLockHi
HNoPurge
HoldMemory
HPurge
HSetRBit
HSetState
HUnlock
InitApplZone
InitZone
InlineGetHandleSize
Used by 68K code.
InvokeGrowZoneUPP
InvokePurgeUPP
InvokeUserFnUPP
IsHandleValid
IsHeapValid
IsPointerValid
LockMemory
LockMemoryContiguous
LockMemoryForOutput
MakeMemoryNonResident
MakeMemoryResident
MaxApplZone
This routine is not needed by PowerPC-based applications because they can specify a stack size in the cfrg resource.
MaxBlock
MaxBlockSys
MaxMem
MaxMemSys
MemError
MoreMasters
MoreMasters will have a longint parameter for specifying the number of master pointers to allocate in the block. Specifying a number less than 32 will result in 32 master pointers in the allocated block, the current standard allocation.
MoveHHi
NewEmptyHandle
NewEmptyHandleSys
NewGrowZoneProc
NewGrowZoneUPP
NewHandle
NewHandleClear
NewHandleSys
NewHandleSysClear
NewPtr
NewPtrClear
NewPtrSys
NewPtrSysClear
NewPurgeProc
NewPurgeUPP
NewUserFnProc
NewUserFnUPP
PageFaultFatal
PtrAndHand
PtrToHand
PtrToXHand
PtrZone
PurgeMem
PurgeMemSys
PurgeProcPtr
PurgeSpace
PurgeSpaceContiguous
PurgeSpaceSysContiguous
PurgeSpaceSysTotal
PurgeSpaceTotal
ReallocateHandle
ReallocateHandleSys
RecoverHandle
RecoverHandleSys
ReleaseMemoryData
ReserveMem
ReserveMemSys
SetApplBase
SetApplLimit
SetGrowZone
SetHandleSize
SetPtrSize
SetZone
StackSpace
StripAddress
There will be no 24-bit memory mode in Mac OS X, so there will be no 24-bit addresses to strip.
SystemZone
TempDisposeHandle
TempFreeMem
TempHLock
TempHUnlock
TempMaxMem
TempNewHandle
Temporary memory allocations will actually come from the applications's address space in Mac OS X. However, Carbon applications running under Mac OS 8.x will be able to get true temporary memory.
TempTopMem
TopMem
Translate24To32
There will be no 24-bit memory mode in Mac OS X, so there is no need to translate from 24- to 32-bit addresses.
UnholdMemory
UnlockMemory
UserFnProcPtr
[Table of Contents] [Manager Index] [Function Index]
Generated on: 7/7/99. Copyright 1999 Apple Computer, Inc. All rights reserved.